package com.sqstudio.exercise.chapter4{
	
	import flash.events.Event;
	
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.materials.WireframeMaterial;
	import org.papervision3d.objects.primitives.Cone;
	import org.papervision3d.view.BasicView;

	[SWF(width="800",height="600")]
	public class WireFrameMaterialExample extends BasicView
	{
		private var cone:Cone;
		public function WireFrameMaterialExample(viewportWidth:Number=800, viewportHeight:Number=600, scaleToStage:Boolean=true, interactive:Boolean=false, cameraType:String="Target")
		{
			super(viewportWidth, viewportHeight, scaleToStage, interactive, cameraType);
			stage.frameRate = 40;
			init();
			this.startRendering();
		}
		
		private function init():void{
			var wireFrame:WireframeMaterial = new WireframeMaterial(0xff0000,0.5,4);
			
			var colorMaterial:ColorMaterial = new ColorMaterial(0xff0000,1,false);
			// 最后一个参数 interactive  为是否可交互
			this.cone = new Cone(colorMaterial,200,500);
			scene.addChild(cone);
		}
		
		override protected function onRenderTick(event:Event=null):void
		{
			cone.localRotationY++;
			super.onRenderTick(event);
		}
	}
}